package com.andy.wan.android.mvp.ui.adapter;

import android.widget.ImageView;

import com.andy.wan.android.R;
import com.andy.wan.android.mvp.bean.FeedArticleData;
import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import androidx.annotation.NonNull;

/**
 * @Author: luofan
 * @CreateDate: 2020/3/17 11:51
 * @Description:
 */
public class ProjectAdapter extends BaseQuickAdapter<FeedArticleData, BaseViewHolder> {

    public ProjectAdapter() {
        super(R.layout.adapter_project);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, FeedArticleData item) {
        ImageView imageView = helper.getView(R.id.img);
        Glide.with(imageView).load(item.getEnvelopePic()).apply(RequestOptions.bitmapTransform(new RoundedCorners(16))).into(imageView);
        helper.setText(R.id.tv_name, item.getTitle());
        helper.setText(R.id.tv_desc, item.getDesc());
        helper.setText(R.id.tv_author, item.getAuthor());
        helper.setText(R.id.tv_time, TimeUtils.getFriendlyTimeSpanByNow(item.getPublishTime()));
    }
}
